Skip to content

Add CakePHP 6.0 rector rules for void return type changes#384

Draft
dereuromark wants to merge 3 commits into5.xfrom
rector/cakephp60-void-returns
Draft

Add CakePHP 6.0 rector rules for void return type changes#384
dereuromark wants to merge 3 commits into5.xfrom
rector/cakephp60-void-returns

Conversation

@dereuromark
Copy link
Member

Summary

Add rector rules for upgrading to CakePHP 6.0, specifically handling methods that changed from returning bool to returning void.

New Rules:

  1. RemoveAssignmentFromVoidMethodRector - Removes variable assignments from method calls that now return void:

    // Before
    $result = $this->request->allowMethod('post');
    
    // After
    $this->request->allowMethod('post');
  2. Method Renames - Renames validChoice() to validateChoice() for console input classes

Affected Methods:

Class Method Change
ServerRequest allowMethod() Returns void
Configure load() Returns void
ResponseEmitter emit() Returns void
Session close() Returns void
Table deleteOrFail() Returns void
FixtureInterface insert() Returns void
FixtureInterface truncate() Returns void
ConsoleInputArgument validChoice() Renamed to validateChoice(), returns void
ConsoleInputOption validChoice() Renamed to validateChoice(), returns void

Related PRs:

Add rector rules for upgrading to CakePHP 6.0:

- RemoveAssignmentFromVoidMethodRector: Removes variable assignments from
  method calls that now return void instead of bool
- Method renames: validChoice() -> validateChoice() for ConsoleInput classes

Affected methods:
- ServerRequest::allowMethod()
- Configure::load()
- ResponseEmitter::emit()
- Session::close()
- Table::deleteOrFail()
- FixtureInterface::insert()
- FixtureInterface::truncate()
- ConsoleInputArgument::validChoice() -> validateChoice()
- ConsoleInputOption::validChoice() -> validateChoice()

Refs cakephp/cakephp#19220
Refs cakephp/cakephp#19243
@LordSimal
Copy link
Contributor

why is this on 5.x? there is a 6.x branch already present with the basic setup for 6.x and a refactored folder structure.

@dereuromark
Copy link
Member Author

Wrong branch jep

@dereuromark dereuromark marked this pull request as draft February 4, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants